﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Baopx_API;

namespace A.Controller
{
    public class UserRoleController
    {


        public static void Insert(UserRole userRole)
        {
            A.M.d.UserRoles.InsertOnSubmit(userRole);
            A.M.d.SubmitChanges();
        }

        public static void Update()
        {
            A.M.d.SubmitChanges();
        }

        public static void Delete(UserRole userRole)
        {
            A.M.d.UserRoles.DeleteOnSubmit(userRole);
            A.M.d.SubmitChanges();
        }

        public static UserRole GetElementById(int id)
        {
            return A.M.d.UserRoles.SingleOrDefault(i => i.Id == id);
        }

        public static List<UserRole> GetAll()
        {
            return A.M.d.UserRoles.ToList();
        }
    }
}
